﻿#include "GxImageGadget.h"
#include "GxImageGadgetPrivate.h"
#include <QPushButton>
#include <QFileDialog>
#include <QDebug>
#include <QShortcut>
#include <QKeySequence>

GxImageGadget::GxImageGadget(QWidget *parent) :
    QWidget(parent)
    , d_ptr(new GxImageGadgetPrivate(this))
{
    setWindowTitle(tr("Image Gadget"));
    setWindowFlags(Qt::Tool | Qt::FramelessWindowHint | Qt::WindowStaysOnBottomHint);
    setAttribute(Qt::WA_TranslucentBackground, true);

    //快捷键
    QShortcut* pNext = new QShortcut(QKeySequence(Qt::Key_Right), this, SLOT(goNext()), nullptr, Qt::WindowShortcut);
    pNext->setAutoRepeat(false);
    QShortcut *pPrevious = new QShortcut(QKeySequence(Qt::Key_Left), this, SLOT(goPrevious()), nullptr, Qt::WindowShortcut);
    pPrevious->setAutoRepeat(false);
}

GxImageGadget::~GxImageGadget()
{
    
}

void GxImageGadget::goNext()
{
    Q_D(GxImageGadget);
    //qDebug() << "to next";
    d->goNext();
}

void GxImageGadget::goPrevious()
{
    Q_D(GxImageGadget);
    //qDebug() << "to previous";
    d->goPrevious();
}
